home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWResour / FWResSin.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  2.6 KB  |  89 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWResSin.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWRESSIN_H
  11. #define FWRESSIN_H
  12.  
  13. #ifndef FWSOMPTR_H
  14. #include "FWSOMPtr.h"
  15. #endif
  16.  
  17. #ifndef FWEXCDEF_H
  18. #include "FWExcDef.h"
  19. #endif
  20.  
  21. #ifndef FWRANSIN_H
  22. #include "FWRanSin.h"
  23. #endif
  24.  
  25. #include "SLResSin.xh"
  26.  
  27. //========================================================================================
  28. // CLASS FW_PResourceSink
  29. //    This class owns an FW_OResourceSink*.  The constructor creates one, the destructor 
  30. //    deletes it.
  31. //
  32. //        Inherited API for operator->()
  33. //            long GetReadableBytes();
  34. //            void Read(in void * destination, in long count);
  35. //            long GetWritableBytes();
  36. //            void Write(in void* source, in long count);
  37. //
  38. //            long GetLength();
  39. //            void SetLength(in long length);
  40. //            long GetPosition();
  41. //            void SetPosition(in long position);
  42. //
  43. //========================================================================================
  44.  
  45. class FW_PResourceSink : public FW_PRandomAccessSink
  46. {
  47. public:
  48.     FW_PResourceSink(Environment* ev, FW_OResourceSink* theResourceSink);
  49.     FW_PResourceSink(Environment* ev, FW_OResource* theResource);
  50.  
  51.     virtual ~FW_PResourceSink();
  52.  
  53. public:
  54.     // Covariant overrides
  55.     FW_OResourceSink*     GetRep()            const;
  56.     FW_OResourceSink*     operator->()        const;
  57.     operator             FW_OResourceSink*()    const;
  58.  
  59. private:
  60.     FW_PResourceSink(const FW_PResourceSink&);
  61.     FW_PResourceSink& operator=(const FW_PResourceSink&);
  62. };
  63.  
  64. //----------------------------------------------------------------------------------------
  65. //    FW_PResourceSink::GetRep
  66. //----------------------------------------------------------------------------------------
  67. inline FW_OResourceSink* FW_PResourceSink::GetRep() const
  68. {
  69.     return (FW_OResourceSink*)FW_PRandomAccessSink::GetRep();
  70. }
  71.  
  72. //----------------------------------------------------------------------------------------
  73. //    FW_PResourceSink::operator->
  74. //----------------------------------------------------------------------------------------
  75. inline FW_OResourceSink* FW_PResourceSink::operator->() const
  76. {
  77.     return GetRep();
  78. }
  79.  
  80. //----------------------------------------------------------------------------------------
  81. //    FW_PResourceSink::operator FW_OResourceSink*
  82. //----------------------------------------------------------------------------------------
  83. inline FW_PResourceSink::operator FW_OResourceSink*() const
  84. {
  85.     return GetRep();
  86. }
  87.  
  88. #endif
  89.